package com.example.guance_demo_emqx;

import java.util.regex.Pattern;

public class FormatValidator {
    public static boolean validateTraceparentFormat(String input) {
        final String PATTERN = "^00-[0-9a-f]{32}-[0-9a-f]{16}-01$";
        final Pattern pattern = Pattern.compile(PATTERN);
        boolean isValid = pattern.matcher(input).matches();
        if (!isValid) {
            System.out.println("traceparent format is incorrect: " + input);
        }
        return isValid;
    }
}